package control;

import javafx.application.Application;
import javafx.scene.Scene;
import javafx.scene.control.Accordion;
import javafx.scene.control.Button;
import javafx.scene.control.TitledPane;
import javafx.scene.layout.StackPane;
import javafx.stage.Stage;

// 标题面板(可单独使用,可放到Accordion中(每次可点开一个))
public class TitledPaneDemo extends Application {
	private StackPane root = new StackPane();
	private Accordion accordion;
	private TitledPane tp1;
	private TitledPane tp2;
	
	public static void main(String[] args) {
		launch(args);
	}
	
	@Override
	public void start(Stage stage) {
		
		tp1 = new TitledPane("ooo", new Button("ooobuttin"));
		tp2 = new TitledPane("ooa", new Button("ooabuttin"));
//		tp2.setExpanded(true);	设置是否展开
//		tp2.setNodeOrientation(NodeOrientation.RIGHT_TO_LEFT);    设置方向
		
		// 放到组中统一管理
		accordion = new Accordion();
		accordion.getPanes().addAll(tp1, tp2);
		root.getChildren().addAll(accordion);
		
		Scene scene = new Scene(root, 300, 250);
		stage.setScene(scene);
		stage.show();
	}
}
